google.setOnLoadCallback(function() {
	$('body').ready(function(){

		$("#optionsForm input[name=pollInterval]").val(getPollInterval()).attr("pattern", "[1-60]");
		
		$("#optionsForm input[type=button]").click(function(){
			var newValue = $("#optionsForm input[name=pollInterval]").val().match(/\d+/);
			if(newValue > 0)
			{
				localStorage.setItem("pollInterval", newValue);
				updateBadgeCounter();
			}
			$("#optionsForm input[name=pollInterval]").val(getPollInterval());
		});
		
	});
});